class Solution {
public:
    void moveZeroes(vector<int>& nums)
    {
        int cur = 0, tmp = 0;
        for (int i = 0; i < nums.size(); i++)
        {
            if (nums[cur] == 0)
            {
                cur++;
            }
            else
            {
                swap(nums[cur], nums[tmp++]);
                cur++;
            }
        }
    }
};